#!/bin/csh 
##..............................................................................
##
## Merge monthly mean fire emission flux and daily (3-hourly) emission ratios 
##
## Author : Kai Zhang (kai.zhang@pnnl.gov) 
##
## Last modified date : 2014-06-04 
##
##..............................................................................

foreach sp (BC OC SO2)
foreach yy (2003 2004 2005 2006 2007 2008 2009 2010 2011)
foreach mm (01 02 03 04 05 06 07 08 09 10 11 12)
foreach dd (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31)

cat > loadit << EOF
   yy = "${yy}" 
   mm = "${mm}" 
   dd = "${dd}" 
   sp = "${sp}" 
EOF

ncl merge.ncl 

end

mkdir $yy 

mv daily_${sp}_${yy}${mm}??.nc $yy 

end

rm ${yy}/daily_${sp}_${yy}0229.nc
rm ${yy}/daily_${sp}_${yy}0230.nc
rm ${yy}/daily_${sp}_${yy}0231.nc
rm ${yy}/daily_${sp}_${yy}0431.nc
rm ${yy}/daily_${sp}_${yy}0631.nc
rm ${yy}/daily_${sp}_${yy}0931.nc
rm ${yy}/daily_${sp}_${yy}1131.nc

end

end




